package com.tedu.bill.demo1;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * Author：毕龙
 * Date: 2024/5/22 20:44
 */
public class TestThreadPool {
    public static void main(String[] args) {
        //固定10个线程
        ExecutorService pool = Executors.newFixedThreadPool(5);
        for (int i = 0; i < 10; i++) {
            int finai = i;
            pool.execute( new Runnable(){

                @Override
                public void run() {
                    System.out.println(Thread.currentThread().getName()+ "\t"+ finai);
                }
            });
        }


    }
}
